class LoadOriginRadiusTable < ActiveRecord::Migration
  def up
    username =  Rails.configuration.database_configuration[Rails.env]["username"]
    password =  Rails.configuration.database_configuration[Rails.env]["password"]
    databasename = Rails.configuration.database_configuration[Rails.env]["database"]
    sql = "#{Rails.root}/db/oradius.sql"

    system "mysql -u#{username} -p#{password} #{databasename} < #{sql}"
  end

  def down 
    tables = [:nas, :radacct, :radcheck, :radgroupcheck, :radgroupreply, :radpostauth, :radreply, :radusergroup]
    tables.each do |t| 
      drop_table t
    end
  end
end
